home *** CD-ROM | disk | FTP | other *** search
- function createUser()
- {
- var _loc2_ = new LoadVars();
- _loc2_.lId = 1;
- _loc2_.name = _global.root.name = name_txt.text;
- _loc2_.age = _global.root.age = 0;
- _loc2_.sex = _global.root.sex = 0;
- SO.setVar("age",0);
- SO.setVar("sex",0);
- SO.setVar("fanOf",0);
- _loc2_.fanOf = 0;
- _loc2_.score = _global.root.getScore();
- _loc2_.r = Math.random();
- _global.root.autosave = true;
- submitAndShowThrobber(_loc2_);
- }
- function updateScore()
- {
- var _loc2_ = new LoadVars();
- _loc2_.lId = 1;
- _loc2_.pId = _global.root.pId;
- _loc2_.score = _global.root.getScore();
- _loc2_.r = Math.random();
- submitAndShowThrobber(_loc2_);
- }
- function submitAndShowThrobber(lv)
- {
- lv.onLoad = scoreSubmitted;
- lv.sendAndLoad(_global.backendURL + "comms/submitscore.comms.php",lv,"GET");
- gotoAndStop("saving");
- }
- function scoreSubmitted(success)
- {
- if(success)
- {
- if(this.result == "success")
- {
- if(!_global.root.pId)
- {
- _global.root.pId = Number(this.pId);
- SO.setVar("pId",_global.root.pId);
- }
- gotoAndStop("saved");
- }
- else
- {
- trace("score submit failed 1: " + this.reason);
- gotoAndStop("error");
- }
- }
- else
- {
- trace("score submit failed 2");
- gotoAndStop("error");
- }
- }
-